package com.btsk.dao.hibernate;

import java.util.List;

import com.btsk.dao.VehicleInfoDao;
import com.btsk.model.DeviceInfo;
import com.btsk.model.NewGpsInfo;
import com.btsk.model.VehicleInfo;
@SuppressWarnings("unchecked")
public class VehicleInfoDaoHibernate extends
		GenericDaoHibernate<VehicleInfo, Long> implements VehicleInfoDao {
	
	public VehicleInfoDaoHibernate() {
		super(VehicleInfo.class);
	}

	@Override
	public List<VehicleInfo> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public VehicleInfo findCarInfoByTermno(String termno) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public List<VehicleInfo> findVehicleInfoByDeviceNo(String[]deviceNo) {
		String s = "";
		for (int i=0;i<deviceNo.length;i++){
			s += "'" + deviceNo[i] + "'";
			if (i < deviceNo.length - 1){
				s += ",";
			}
		}
		return getHibernateTemplate().find("from VehicleInfo o where o.deviceInfo.deviceNo in (" + s + ")");
	}

	@Override
	public List<VehicleInfo> findAllTypeVehicleInfo() {
		return getHibernateTemplate().find(
				"from VehicleInfo o where o.vehicleType is not null");
	}
}
